Skip to content

Commit afc8d99

Browse files
authored
Merge pull request #356 from twibiral/develop
Update to version 1.12.0
2 parents 102fc4e + b3bc966 commit afc8d99

10 files changed

Lines changed: 36 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77

8+
## [1.12.0]
9+
### Added
10+
- Dynamic path changes by adding %USERNAME% to the path (usable for python) (Thanks to @raffy8361)
11+
12+
### Changed
13+
- Fix wrong code example in Readme (Thanks to @danielmeloalencar)
14+
- Fix file separator bug (Thanks to @nfiles)
15+
- Fix un-stoppable runtime environments (Thanks to @jamesbtan)
16+
17+
818
## [1.11.1]
919
### Changed
1020
- Fix the update; the previous version was not published correctly.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ Variables functions, etc. defined in one code block will be available in other c
640640
console.log(f)
641641
```
642642
```js
643-
let f = 3;
643+
var f = 3;
644644
```
645645
``````
646646

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "execute-code",
33
"name": "Execute Code",
4-
"version": "1.11.1",
4+
"version": "1.12.0",
55
"minAppVersion": "1.2.8",
66
"description": "Allows to execute code snippets within a note. Supported programming languages: C, CPP, Dart, Golang, Groovy, Kotlin, Java, JavaScript, TypeScript, Lean, Lua, CSharp, Prolog, Rust, Python, R, Ruby, Wolfram Mathematica, Haskell, Scala, Racket, F#, Batch, Shell & Powershell.",
77
"author": "twibiral",

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "execute-code",
3-
"version": "1.11.1",
3+
"version": "1.12.0",
44
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
55
"main": "src/main.js",
66
"scripts": {

src/executors/Executor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Notice} from "obsidian";
22
import {Outputter} from "src/Outputter";
33
import * as os from "os";
4+
import * as path from "path";
45
import {LanguageId} from "src/main";
56
import {EventEmitter} from "stream";
67

@@ -63,6 +64,6 @@ export default abstract class Executor extends EventEmitter {
6364
protected getTempFile(ext: string) {
6465
if (this.tempFileId === undefined)
6566
this.tempFileId = Date.now().toString();
66-
return `${os.tmpdir()}\\temp_${this.tempFileId}.${ext}`;
67+
return path.join(os.tmpdir(), `temp_${this.tempFileId}.${ext}`);
6768
}
6869
}

src/executors/ReplExecutor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export default abstract class ReplExecutor extends AsyncExecutor {
2424
path = "wsl";
2525
}
2626

27+
// Replace %USERNAME% with actual username (if it exists)
28+
if (path.includes("%USERNAME%") && process?.env?.USERNAME)
29+
path = path.replace("%USERNAME%", process.env.USERNAME);
30+
2731
// Spawns a new REPL that is used to execute code.
2832
// {env: process.env} is used to ensure that the environment variables are passed to the REPL.
2933
this.process = spawn(path, args, {env: process.env});

src/executors/killWithChildren.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ export default (pid: number) => {
44
if(process.platform === "win32") {
55
execSync(`taskkill /pid ${pid} /T /F`)
66
} else {
7-
execSync(`pkill -P ${pid}`)
7+
try {
8+
execSync(`pkill -P ${pid}`)
9+
} catch(err) {
10+
// An error code of 1 signifies that no children were found to kill
11+
// In this case, ignore the error
12+
// Otherwise, re-throw it.
13+
if (err.status !== 1) throw err;
14+
}
815
process.kill(pid);
916
}
10-
}
17+
}

version-bump.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* This script updates the version in manifest.json, package-lock.json, versions.json and CHANGELOG.md
3+
* with the version specified in the package.json.
4+
*/
5+
16
import {readFileSync, writeFileSync} from "fs";
27

38
const targetVersion = process.env.npm_package_version;

versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
"1.9.1": "1.2.8",
4747
"1.10.0": "1.2.8",
4848
"1.11.0": "1.2.8",
49-
"1.11.1": "1.2.8"
49+
"1.11.1": "1.2.8",
50+
"1.12.0": "1.2.8"
5051
}

0 commit comments

Comments
 (0)