@@ -1123,7 +1123,11 @@ fs.lstatSync = function(path) {
1123
1123
handleError ( ( path = getPathFromURL ( path ) ) ) ;
1124
1124
nullCheck ( path ) ;
1125
1125
validatePath ( path ) ;
1126
- binding . lstat ( pathModule . toNamespacedPath ( path ) ) ;
1126
+ const ctx = { path } ;
1127
+ binding . lstat ( pathModule . toNamespacedPath ( path ) , undefined , ctx ) ;
1128
+ if ( ctx . errno !== undefined ) {
1129
+ throw new errors . uvException ( ctx ) ;
1130
+ }
1127
1131
return statsFromValues ( ) ;
1128
1132
} ;
1129
1133
@@ -1874,7 +1878,11 @@ fs.realpathSync = function realpathSync(p, options) {
1874
1878
1875
1879
// On windows, check that the root exists. On unix there is no need.
1876
1880
if ( isWindows && ! knownHard [ base ] ) {
1877
- binding . lstat ( pathModule . toNamespacedPath ( base ) ) ;
1881
+ const ctx = { path : base } ;
1882
+ binding . lstat ( pathModule . toNamespacedPath ( base ) , undefined , ctx ) ;
1883
+ if ( ctx . errno !== undefined ) {
1884
+ throw new errors . uvException ( ctx ) ;
1885
+ }
1878
1886
knownHard [ base ] = true ;
1879
1887
}
1880
1888
@@ -1914,7 +1922,11 @@ fs.realpathSync = function realpathSync(p, options) {
1914
1922
// for our internal use.
1915
1923
1916
1924
var baseLong = pathModule . toNamespacedPath ( base ) ;
1917
- binding . lstat ( baseLong ) ;
1925
+ const ctx = { path : base } ;
1926
+ binding . lstat ( baseLong , undefined , ctx ) ;
1927
+ if ( ctx . errno !== undefined ) {
1928
+ throw new errors . uvException ( ctx ) ;
1929
+ }
1918
1930
1919
1931
if ( ( statValues [ 1 /*mode*/ ] & S_IFMT ) !== S_IFLNK ) {
1920
1932
knownHard [ base ] = true ;
@@ -1957,7 +1969,11 @@ fs.realpathSync = function realpathSync(p, options) {
1957
1969
1958
1970
// On windows, check that the root exists. On unix there is no need.
1959
1971
if ( isWindows && ! knownHard [ base ] ) {
1960
- binding . lstat ( pathModule . toNamespacedPath ( base ) ) ;
1972
+ const ctx = { path : base } ;
1973
+ binding . lstat ( pathModule . toNamespacedPath ( base ) , undefined , ctx ) ;
1974
+ if ( ctx . errno !== undefined ) {
1975
+ throw new errors . uvException ( ctx ) ;
1976
+ }
1961
1977
knownHard [ base ] = true ;
1962
1978
}
1963
1979
}
0 commit comments