dashcam 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/package.json +2 -1
- package/recorder.js +12 -2
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dashcam",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Fix bugs, close pulls, and update your team with desktop instant replay.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"cli-color": "^2.0.3",
|
|
17
17
|
"commander": "^9.4.0",
|
|
18
|
+
"find-process": "^1.4.7",
|
|
18
19
|
"husky": "^7.0.4",
|
|
19
20
|
"node-ipc": "^10.1.0",
|
|
20
21
|
"node-pty-prebuilt-multiarch": "^0.10.1-pre.5",
|
package/recorder.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const pty = require("node-pty-prebuilt-multiarch");
|
|
3
|
+
const process = require("process");
|
|
4
|
+
const find = require("find-process");
|
|
3
5
|
|
|
4
6
|
class Recorder {
|
|
5
7
|
#ptyProcess = null;
|
|
@@ -24,7 +26,7 @@ class Recorder {
|
|
|
24
26
|
fs.appendFileSync(this.#logFile, data, "ascii");
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
start() {
|
|
29
|
+
async start() {
|
|
28
30
|
console.log(
|
|
29
31
|
"This session is being recorded by Dashcam and dumped to",
|
|
30
32
|
this.#logFile
|
|
@@ -34,7 +36,15 @@ class Recorder {
|
|
|
34
36
|
// TODO: Find a way to consistently get the current shell this is running from
|
|
35
37
|
// instead of using the default user shell (Maybe use parent processId to find
|
|
36
38
|
// the process filepath)
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
const shell = (
|
|
41
|
+
process.env.SHELL ||
|
|
42
|
+
(await find("pid", process.ppid).then((arr) => arr[0].bin)) ||
|
|
43
|
+
""
|
|
44
|
+
).trim();
|
|
45
|
+
|
|
46
|
+
if (!shell) throw new Error("Could not detect the current shell");
|
|
47
|
+
|
|
38
48
|
const args = [];
|
|
39
49
|
if (!shell.toLowerCase().includes("powershell")) args.push("-l");
|
|
40
50
|
this.#ptyProcess = pty.spawn(shell, args, {
|