Skip to content
Snippets Groups Projects
Commit 0c1e4fb1 authored by ali asaria's avatar ali asaria
Browse files

fix 0.2.2 version of app to handle bash properly

parent 5243f363
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ const fs = require('fs');
const os = require('os');
const { spawn, exec, ChildProcess } = require('child_process');
const homeDir = os.homedir();
const tranformerlabHomeDir = path.join(homeDir, '.transformerlab');
const transformerLabDir = path.join(homeDir, '.transformerlab/src/');
var localServer: typeof ChildProcess = null;
......@@ -45,7 +46,7 @@ export function startLocalServer() {
// The following two options allow it to keep running after parent is closed
detached: true,
stdio: ['ignore', out, err],
shell: true,
shell: '/bin/bash',
};
console.log('Starting local server at', mainFile);
localServer = spawn('bash', [mainFile], options);
......@@ -73,12 +74,12 @@ export function startLocalServer() {
resolve({ status: 'success', code: code });
} else {
resolve({
status: 'error', code: code ,
message: 'May be fixed by running ~/.transformerlab/src/init.sh'
status: 'error',
code: code,
message: 'May be fixed by running ~/.transformerlab/src/init.sh',
});
}
});
});
}
......@@ -105,7 +106,11 @@ export function killLocalServer() {
export function installLocalServer() {
console.log('Installing local server');
const options = { shell: '/bin/sh' };
if (!fs.existsSync(tranformerlabHomeDir)) {
fs.mkdirSync(tranformerlabHomeDir);
}
const options = { shell: '/bin/sh', cwd: tranformerlabHomeDir };
try {
const child = exec(
'curl https://raw.githubusercontent.com/transformerlab/transformerlab-api/main/download_and_install_remote_script.sh | sh',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment