Skip to content

Commit

Permalink
Merge pull request #38 from casper-network/fix/daemon-stop-issue
Browse files Browse the repository at this point in the history
Stop command parse arg issue
  • Loading branch information
Ryo Kanazawa authored Aug 2, 2023
2 parents bb396cd + 1aefa04 commit 0679a5a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [0.0.3] - 2023-08-02

### Fixed

- `stop` command arg parse issue. ([#38](https://github.com/casper-network/casper-node-launcher-js/pull/38))

## [0.0.2] - 2023-08-01

### Changed
Expand All @@ -29,5 +35,6 @@ Initial version of `casper-node-launcher-js`.

- Started to use CHANGELOG.

[0.0.2]: https://github.com/casper-network/casper-node-launcher-js/compare/0.0.2...main
[0.0.3]: https://github.com/casper-network/casper-node-launcher-js/compare/0.0.3...main
[0.0.2]: https://github.com/casper-network/casper-node-launcher-js/compare/0.0.2...0.0.2
[0.0.1]: https://github.com/casper-network/casper-node-launcher-js/compare/0.0.1...0.0.2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "casper-node-launcher-js",
"version": "0.0.2",
"version": "0.0.3",
"description": "CLI makes easy to run single casper node for test purpose",
"author": "Ryo Kanazawa <[email protected]>",
"bin": {
Expand Down
9 changes: 6 additions & 3 deletions src/commands/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ export default class Stop extends Command {
static description = "Stop running node in background.";

async run(): Promise<void> {
const { args } = await this.parse(Stop);
const workDir = path.resolve(__dirname, "../..", WORK_DIR);
const pidFilePath = path.resolve(workDir, ".pid");

if (!fs.existsSync(pidFilePath)) {
this.error("No running node found", { exit: -1 });
}

const workDir = path.resolve(__dirname, "../..", WORK_DIR, args.branch);
const pidFilePath = path.resolve(workDir, "../.pid");
const pid = fs.readFileSync(pidFilePath, {
encoding: "utf8",
});
Expand Down

0 comments on commit 0679a5a

Please sign in to comment.