[Jprogramming] spawn and cygwin

Dan Bron jf at dbron.net
Sat Feb 10 06:17:48 HKT 2007


Oleg/other forum members:

Is there any way to use spawn_jtask_ to "talk to" Cygwin's bash shell?  I thought that 

	shell_script =: noun define
	  some shell commands
	  like, for example, ls
	  or cat
	)
	
	require 'task'
	output =: shell_script spawn 'C:\cygwin\bin\bash.exe'

would work, but it does not.  The bash commands are being interpreted as if they're running under cmd.exe. 

For example, I have two versions of wget: one compiled for Windows, one for Cygwin.  The Windows one is slightly older and doesn't support the "--save-cookies" option.  So, in cmd.exe, this happens:

	wget --save-cookies URL
	wget: unrecognized option `--save-cookies'

but the same command executes fine under bash.exe.

My problem is when I try to spawn a bash from J, I get the cmd.exe behavior, not the bash.exe behavior:

	   require 'task'
	   ('wget --save-cookies URL',LF) spawn 'C:\cygwin\bin\bash.exe'
	wget: unrecognized option `--save-cookies'


For various complicated reasons, I cannot write my shell script to a file, the entire thing has to be a J noun passed as stdin to bash.exe.  Am I out of luck?

-Dan

PS:  I recommend that spawn be modified to optionally take a "working directory" for the process.  I have made this modification in my local copy.



More information about the Programming mailing list