Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cli]: Use temporary folder for plugin creation to be able to clean up easy #171

Merged
merged 7 commits into from
Mar 6, 2020

Conversation

marcuseide
Copy link
Collaborator

Create all files and run all commands in a temp folder, and then atomically move it to it's final destination if everything succeeded. If not, remove the temp directory and all the files in it.

@marcuseide marcuseide requested a review from a team as a code owner March 5, 2020 13:59
process.stdout.write(chalk.green(` Cleaning up ${chalk.cyan(id)}`));
try {
fs.rmdirSync(tempDir, { recursive: true });
process.stdout.write(chalk.green(MARKER_SUCCESS));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am still not entirely clear on why it sometimes is console.log and sometimes process.stdout.write (and why not process.stderr.write for errors)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that it's cumbersome to remove a newline in console.log()

} catch (e) {
process.stdout.write(chalk.red(` ✗\n`));
process.stdout.write(chalk.red(MARKER_FAILURE));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the markers already have colors applied right? this goes for all of the usages below ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@marcuseide
Copy link
Collaborator Author

Screen Recording 2020-03-06 at 11 09 27

@marcuseide
Copy link
Collaborator Author

Fixes #164 and #169

@stefanalund
Copy link
Contributor

🚢

@stefanalund stefanalund merged commit dcc62dd into master Mar 6, 2020
@stefanalund stefanalund deleted the eide/cli-atomic branch March 6, 2020 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants