Skip to content

fix(open): set wait: false to run server.close successfully - #2001

Merged
hiroppy merged 4 commits into
masterfrom
feature/fix-open
Jun 10, 2019
Merged

fix(open): set wait: false to run server.close successfully#2001
hiroppy merged 4 commits into
masterfrom
feature/fix-open

Conversation

@hiroppy

@hiroppyhiroppy commented Jun 8, 2019

Copy link
Copy Markdown
Contributor

fixes: #1990

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

yes

Motivation / Use-Case

see #1990

commit: sindresorhus/open@da2d663#diff-168726dbe96b3ce427e7fedce31bb0bcR23

Our open(opn)'s version is old, and wait seems to be true by default in this version.

Breaking Changes

no

Additional Info

alexander-akait
alexander-akait previously approved these changes Jun 8, 2019

@alexander-akaitalexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch 👍

@codecov

codecovBot commented Jun 9, 2019

Copy link
Copy Markdown

Codecov Report

Merging #2001 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@## master #2001 +/- ##
=======================================
Coverage 92.77% 92.77% =======================================
Files 29 29 Lines 1149 1149 Branches 327 327 =======================================
Hits 1066 1066 Misses 79 79 Partials 4 4
Impacted FilesCoverage Δ
lib/utils/runOpen.js100% <100%> (ø)⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90d4a7c...eb3fce5. Read the comment docs.

@hiroppy

Copy link
Copy Markdown
ContributorAuthor

@evilebottnawi I added one commit(fdc6d31). PTAL

@alexander-akaitalexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need modify object, it is really bad practice

Comment threadlib/utils/runOpen.js Outdated
openOptions = { app: options.open };
Object.assign(openOptions, {
app: options.open,
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

letopenOptions={wait: false};// ...if(typeofoptions.open==='string'){openOptions=Object.assign({}openOptions,{app: options.open});}

No need modify openOptions variable, it is very bad practice

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

openOptions = Object.assign({} openOptions, { app: options.open }); equals Object.assign(openOptions, { app: options.open }).

I don't think this is a very bad practice.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, but it is not good, we modify original object and it is bad practice because you can forget about this in future and it is lead to some problems when you refactor code.

When you pass options to third party package(s) better always cloning object. Other package can modify object too so it can lead to very strange errors and situations.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

When you pass options to third party package(s) better always cloning object. Other package can modify object too so it can lead to very strange errors and situations.

If you say, we should not assign to the same variable.

I don't have any strong opinions, so I'll change.

@hiroppy

Copy link
Copy Markdown
ContributorAuthor

@evilebottnawi PTAL

@alexander-akaitalexander-akait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good work!

Sign up for freeto 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.

server.close no longer works as of 3.4.0

2 participants

@hiroppy@alexander-akait