izuzak / atom-pdf-view

Support for viewing PDF files in Atom.
https://atom.io/packages/pdf-view
MIT License
106 stars 30 forks source link

Uncaught Error: ENOENT: no such file or directory, open '/home/.../root.pdf #70

Closed nielsvd closed 8 years ago

nielsvd commented 9 years ago

[If PDF doesn't exist, pdf-view crashes]

  1. Open pdf-file with pdf-view
  2. Remove pdf-file from disk

Use case: pdf-file is removed by latex-package when a "clean"-command is given. Simply showing text with "Cannot find PDF" instead of crashing would be great.

Atom Version: 1.0.7 System: linux 4.1.5-1-ARCH Thrown From: pdf-view package, v0.23.0

Stack Trace

Uncaught Error: ENOENT: no such file or directory, open '/home/***/root.pdf'

At fs.js:519

Error: ENOENT: no such file or directory, open '/home/niels/***/root.pdf'
  at Error (native)
  at Object.fs.openSync (fs.js:544:18)
  at Object.module.(anonymous function) [as openSync] (ATOM_SHELL_ASAR.js:118:20)
  at Object.fs.readFileSync (fs.js:396:15)
  at Object.fs.readFileSync (ATOM_SHELL_ASAR.js:369:29)
  at PdfEditorView.module.exports.PdfEditorView.updatePdf (/home/niels/.atom/packages/pdf-view/lib/pdf-editor-view.coffee:110:33)
  at /home/niels/.atom/packages/pdf-view/lib/pdf-editor-view.coffee:44:12
  at later (/usr/share/atom/resources/app.asar/node_modules/underscore-plus/node_modules/underscore/underscore.js:724:25)

Commands

  4x -4:59.3.0 latex:build (div.pdf-view)
     -3:16.8.0 settings-view:check-for-package-updates (atom-workspace.workspace.scrollbars-visible-always.theme-one-dark-syntax.theme-one-dark-ui)
  6x -2:51 latex:build (atom-text-editor.editor.is-focused)
     -0:18.3.0 editor:newline (atom-text-editor.editor.is-focused)
     -0:13.2.0 core:save (atom-text-editor.editor.is-focused)
  2x -0:12.5.0 latex:build (atom-text-editor.editor.is-focused)
     -0:00.7.0 latex:clean (atom-text-editor.editor.is-focused)

Config

{
  "core": {}
}

Installed Packages

# User
language-cmake, v0.1.4
language-latex, v0.6.1
latex, v0.25.0
latexer, v0.2.4
minimap, v4.13.1
pdf-view, v0.23.0

# Dev
No dev packages
izuzak commented 9 years ago

Thanks for the report, @nielsvd. I wasn't able to reproduce this on OSX -- here's what I did:

  1. Opened a pdf in Atom with pdf-view
  2. Switched to the terminal and deleted the file with rm

The pdf file was still open in Atom and no exceptions were reported. Did I understand correctly that these steps trigger the exception for you? It's possible that there are some OS-level differences here (you're on linux), so would be great to confirm exact steps which reproduce this for you.

nielsvd commented 9 years ago

Hi @izuzak,

I don't seem to be able to reproduce the problem at the moment either, i.e. I try remove via terminal (rm) and using the latex-plugin like yesterday. I will notify you when I stumble upon the problem again.

nielsvd commented 9 years ago

The problem appeared again, unfortunately it seems to be nontrivial to reproduce. I will reply to this issue if I find I reliable way of reproduction.

It ocurred after cleaning the folder with the atom-latex package (again).

Stack-trace:

fs.js:519
Hide Stack Trace
Error: ENOENT: no such file or directory, open '/home/.../description.pdf'
  at Error (native)
  at Object.fs.openSync (fs.js:544:18)
  at Object.module.(anonymous function) [as openSync] (ATOM_SHELL_ASAR.js:118:20)
  at Object.fs.readFileSync (fs.js:396:15)
  at Object.fs.readFileSync (ATOM_SHELL_ASAR.js:369:29)
  at PdfEditorView.module.exports.PdfEditorView.updatePdf (/home/niels/.atom/packages/pdf-view/lib/pdf-editor-view.coffee:110:33)
  at /home/niels/.atom/packages/pdf-view/lib/pdf-editor-view.coffee:44:12
  at later (/usr/share/atom/resources/app.asar/node_modules/underscore-plus/node_modules/underscore/underscore.js:724:25)
izuzak commented 9 years ago

Thanks for reopening. Yeah, I guess this is a real problem, but don't have the time to investigate right now. If someone wants to make a pull request -- I'd be happy to review+merge.