@@ -18,19 +18,30 @@ const execute = (socket, topic, req) => {
1818
1919 // Store code in tmp file
2020 const previousfile = tmp . tmpNameSync ( )
21- const commandFile = tmp . tmpNameSync ( )
21+ const commandFile = tmp . tmpNameSync ( {
22+ postfix : process . platform === 'win32' ? '.bat' : '.sh'
23+ } )
2224 fs . writeFileSync ( commandFile , req . command )
2325
2426 // Given the command to execute, get the program's name and its parameters
2527 // in order to pass them to child_process.spawn
26- const command = process . platform === 'win32' ? 'sh ' : 'bash'
27- let parameters = [ commandFile ]
28-
28+ const command = process . platform === 'win32' ? 'start ' : 'bash'
29+ let parameters = [ ]
30+
2931 // Check if the command is attaching the output from the previous flow's step
3032 if ( req . previous ) {
3133 fs . writeFileSync ( previousfile , req . previous )
32- parameters . push ( '--tf_previous_file' )
33- parameters . push ( previousfile )
34+ if ( process . platform === 'win32' ) {
35+ parameters . push ( '' )
36+ parameters . push ( commandFile )
37+ parameters . push ( '--tf_previous_file' )
38+ parameters . push ( previousfile )
39+ }
40+ else {
41+ parameters . push ( commandFile )
42+ parameters . push ( '--tf_previous_file' )
43+ parameters . push ( previousfile )
44+ }
3445 }
3546
3647 // Execute the command in a child process so that stds can be monitored
0 commit comments