Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Don't use deprecated [l]statSyncNoException methods in Electron >= 3 #46

Merged
merged 1 commit into from
Dec 14, 2018

Conversation

daviwil
Copy link
Contributor

@daviwil daviwil commented Dec 14, 2018

fs.statSyncNoException and fs.lstatSyncNoException have been deprecated in Electron 3.0 and might be removed in a future release. This change updates fs-plus to expose wrappers that only use these methods when the fs module provides them and we're not currently running in Electron 3.0 or higher.

Verification Steps

  • Ensure deprecated fs method are not used in Electron 3.0 apps
  • Ensure fs methods are used in Electron 2.0 and lower apps
  • Ensure that fs-plus implementation is used in plain Node.js apps

Copy link

@jasonrudolph jasonrudolph left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me. Are there operations we can perform in Atom to verify that this is having the desired effect?

@daviwil
Copy link
Contributor Author

daviwil commented Dec 14, 2018

Yep, just open an Atom build with Electron 3.0:

Before

image

After

image

Opening any folder in tree-view will cause a bunch of deprecation warning spew without these changes. The last two warnings are coming from a package or library that uses the fs API directly and not through fs-plus.

@daviwil
Copy link
Contributor Author

daviwil commented Dec 14, 2018

Added some verification steps with a couple other cases to try! Will run through those before merging/shipping.

@daviwil daviwil merged commit d7cd288 into master Dec 14, 2018
@daviwil daviwil deleted the dw-deprecated-noexception branch December 14, 2018 18:13
rafeca added a commit to rafeca/coffeestack that referenced this pull request May 15, 2019
This PR upgrades the `fs-plus` dependency to get rid of the deprecation warnings that appear on the console when running this module on Node v10. More info: atom/fs-plus#46
as-cii pushed a commit to atom/atom that referenced this pull request May 20, 2019
This commit fixes some deprecation warnings we were observing in our 
test suite, as well as when opening packages that registered protocol 
handlers such as the `welcome` package.

The warnings were due to using the `fs.(l)statSyncNoException` API, 
which will be deprecated from Electron 4 onwards. We had already dealt 
with this by shipping atom/fs-plus#46, which 
provided a shim on `fs-plus` to suppress the warning. However, 
`AtomProtocolHandler` was still using the standard `fs` module, which 
was causing the warning to be displayed whenever a package registered a 
URL opener.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants