-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
26 lines (24 loc) · 713 Bytes
/
main.js
File metadata and controls
26 lines (24 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const execSync = require("child_process").execSync;
module.exports.templateTags = [
{
name: "pyScript",
displayName: "Python Script",
description: "Run python3 script.",
args: [
{
displayName: "File path",
placeholder: '~/file.py',
type: "string",
},
],
async run(context, path) {
try {
var resp = execSync( `python3 ${path}`, { encoding: "utf-8" });
} catch (failed) {
console.log("Command execution failed with " + failed);
return failed.stderr;
}
return resp.trim();
},
},
];