Skip to content

Commit f83a914

Browse files
committed
use file extensions
1 parent 532a518 commit f83a914

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tideflowio/tideflow-agent",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "Tideflow.io's agent",
55
"main": "index.js",
66
"keywords": [

services/agent.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)