-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Terminal: Bring back / enable TerminalService API (#20)
* Bring back node-pty, update lockfile * Revert changes to terminalProcess.ts * Update node to pick up latest 10.x * Experiment with npmrc * Revert "Experiment with npmrc" This reverts commit a0db22b. * Remove yarnrc * Remove electron checks * Remove gc-signals * it...built? * Logging / hacks to get terminal service available * Revert changes to mainThreadHeapService * Add test case for terminal execution * Simplify first test to just check for process exit * Fix bug with windows terminal output * Add test for / * Clean up, add config neeeded to enable terminal * Get tests green with configuration update * Remove logging * Save sandbox test
- Loading branch information
Showing
14 changed files
with
234 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import * as path from "path"; | ||
|
||
import * as ExtensionHost from "./ExtensionHost"; | ||
|
||
let extensionPath = path.join(__dirname, "..", "test_extensions", "oni-api-tests", "package.json"); | ||
|
||
describe("Terminal", () => { | ||
test("Verify we get a $sendProcessExit for a command that does not exist", async () => { | ||
await ExtensionHost.withExtensionHost([extensionPath], async (api) => { | ||
|
||
let terminalSendProcessExit = | ||
api.waitForMessageOnce("MainThreadTerminalService", "$sendProcessExit", (args) => { | ||
console.log("$sendProcessExit: " + args[1]); | ||
return true; | ||
}); | ||
|
||
await api.start(); | ||
|
||
api.terminalCreateProcess(1, { | ||
name: "Terminal 1", | ||
executable: "/non-existent-item", | ||
args: [], | ||
}, | ||
20, | ||
20); | ||
|
||
await terminalSendProcessExit; | ||
}); | ||
}); | ||
|
||
test("Verify we get a $sendProcessData / $sendProcessTitle for a command that works", async () => { | ||
await ExtensionHost.withExtensionHost([extensionPath], async (api) => { | ||
let terminalSendProcessTitle = | ||
api.waitForMessageOnce("MainThreadTerminalService", "$sendProcessTitle", (args) => { | ||
console.log("$sendProcessTitle: " + args[1]); | ||
return true; | ||
}); | ||
|
||
let terminalSendProcessData = | ||
api.waitForMessageOnce("MainThreadTerminalService", "$sendProcessData", (args) => { | ||
console.log("$sendProcessData: " + args[1]); | ||
return true; | ||
}); | ||
|
||
let terminalSendProcessExit = | ||
api.waitForMessageOnce("MainThreadTerminalService", "$sendProcessExit", (args) => { | ||
console.log("$sendProcessExit: " + args[1]); | ||
return true; | ||
}); | ||
|
||
let terminalArgs: any = null; | ||
if(process.platform == "win32") { | ||
terminalArgs = { | ||
name: "Windows Terminal", | ||
executable: "cmd.exe", | ||
args: ["/c", "echo", "hello"] | ||
} | ||
} else { | ||
|
||
terminalArgs = { | ||
name: "Bash Terminal", | ||
executable: "bash", | ||
args: ["-c", "echo hello"] | ||
} | ||
} | ||
|
||
await api.start(); | ||
|
||
api.terminalCreateProcess( | ||
1, | ||
terminalArgs, | ||
20, | ||
20); | ||
|
||
await terminalSendProcessTitle; | ||
await terminalSendProcessData; | ||
await terminalSendProcessExit; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
steps: | ||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: "10.15.1" | ||
versionSpec: "10.x" | ||
- powershell: | | ||
npm install -g [email protected] | ||
displayName: Install jest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.