File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
docs/development/advanced Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1+ # Debugging
2+ > How to deal with errors in the extension
3+
4+ ## Test shell commands
5+
6+ This snippet of code can be used to for testing that a basic command works without error and output can be shown.
7+
8+ ``` typescript
9+ /**
10+ * Debug tool for checking that a basic command works.
11+ * Replace the `makeAndFillCommitMsg` call with `test` to use this.
12+ */
13+ async function _test(repository : Repository ) {
14+ vscode .window .showInformationMessage (" Testing" )
15+
16+ let cwd = repository .rootUri .fsPath ;
17+
18+ vscode .window .showInformationMessage (cwd )
19+
20+ const resp = await _execute (cwd , ' git --version' )
21+ vscode .window .showInformationMessage (` ${resp .stdout } -- ${resp .stderr } ` )
22+ }
23+ ```
24+
25+ ### Background
26+
27+ This was prompted by issue [ #93 ] ( https://github.com/MichaelCurrin/auto-commit-msg/issues/93 ) on Windows.
28+
29+ The output in the debug mode did not work because the shell command failed to spawn at all using ` exec() ` in Node.
30+
31+ The ` cwd ` value was incorrect from the existing logs which I didn't notice initially but using the test above made it clear.
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ async function _diffIndex(
3636 repository : Repository ,
3737 options : string [ ] = [ ]
3838) : Promise < Array < string > > {
39- const cwd = repository . rootUri . path ;
39+ const cwd = repository . rootUri . fsPath ;
4040 const cmd = "diff-index" ;
4141 const fullOptions = [
4242 "--name-status" ,
You can’t perform that action at this time.
0 commit comments