Skip to content

Commit

Permalink
handle start on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bmerkle committed Oct 7, 2024
1 parent 0cf880a commit d9599c2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion packages/vscode/src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import kill from "tree-kill";
import getPort from "get-port";
import { log } from "./log";
import { CellOutputPanes } from "./cellOutputPanes";
import { platform } from 'os';

const isWindows = platform() === 'win32';
const isLinux = platform() === 'linux';


function cellOutputToNotebookCellOutput(cellOutput: CellOutput) {
return new vscode.NotebookCellOutput(
Expand Down Expand Up @@ -102,17 +107,28 @@ export class NotebookController {
}

private async start() {
let command: string;
if (isWindows) {
command = 'node_modules/.bin/vitale.cmd';
} else if (isLinux) {
command = 'node_modules/.bin/vitale';
} else {
command = 'node_modules/.bin/vitale.ps1';
}

const process = spawn(
"node_modules/.bin/vitale",
command,
["--port", String(this._port)],
{
cwd: this._cwd,
shell: true, // Ensure the correct script is invoked
// env: {
// ...process.env,
// DEBUG: "vite:*",
// },
}
);

process.stdout?.on("data", (data) => {
log.info(data.toString());
});
Expand Down

0 comments on commit d9599c2

Please sign in to comment.