Args for sb-ext:run-program

2019-07-02 21:06发布

问题:

Can someone tell me exactly what the args argument should look like for sb-ext:run-program?

If I do this:

(sb-ext:run-program "C:/Program Files/iTunes/iTunes.exe" 
               "C:/lispbox-0.7/opus.mid")

I get this error:

debugger invoked on a TYPE-ERROR:
  The value "C:/lispbox-0.7/opus.mid" is not of type LIST.

However, if I do this:

(sb-ext:run-program "C:/Program Files/iTunes/iTunes.exe" 
               (list "C:\lispbox-0.7\opus.mid"))

iTunes opens, but the MIDI file doesn't play, even though this invocation from the Windows command prompt works just fine:

U:\>"C:\Program Files\iTunes\iTunes.exe" C:\lispbox-0.7\opus.mid

Note that this (with forward slashes):

CL-USER> (sb-ext:run-program "C:/Program Files/iTunes/iTunes.exe" 
               (list "C:/lispbox-0.7/opus.mid"))

has the same effect: iTunes opens, but the file is not played.

回答1:

In the list version you're using single backslashes, which get parsed as escape sequences. You need to use double backslashes.