I do think it’s something in the original script that created trouble, not necessarily my system (although I’m in no position to judge). Here’s another set of attempts at figuring out the problem.
First, as you requested:
./splitter.rb splitter-test.md 2>&1 >> splitter.log
gives me
./splitter.rb:41:in `block in <main>': undefined method `rewind' for nil:NilClass (NoMethodError)
from ./splitter.rb:40:in `each_pair'
from ./splitter.rb:40:in `<main>'
and
./splitter.rb splitter-test.md
gives me
=== ------------------------------------------------------ ===
=== Splitter V1.0 Report @ 2019-04-22 10:11:31 +0200 ===
=== ------------------------------------------------------ ===
Working directory: /Users/me/Documents/Academic/Writing/troubleshooting
Initiating with Ruby 2.3.7
Pandoc: /usr/local/bin/pandoc | V: 2.7.2
./splitter.rb:41:in `block in <main>': undefined method `rewind' for nil:NilClass (NoMethodError)
from ./splitter.rb:40:in `each_pair'
from ./splitter.rb:40:in `<main>'
That seems fine, right?
I’ve then tried to systematically test all variables (and combinations thereof) again, first with the original splitter scrivener project downloaded from the other thread, then with the one you’ve provided above.
In the original project, top-level folders (called Red and Black book) have been duplicated to produce a total of 20 separate files.
I have left everything in that script as provided except for the last line (and when using pandoc also checking the “Pandoc syntax” checkbox) and the arguments field in the Scrivener dialog.
First, I’ve experimented with the arguments field left blank (as it was in the original).
This is what I get for each of the commands (the last line of the script):
(a)
`multimarkdown -t latex -o #{filename} #{tmpfile.path}`
works without problem (produces all the 20 .tex files).
(b)
cmd = "pandoc --verbose -t latex -o #{filename} #{tmpfile.path} 2>&1"
works but does not produce any .tex file.
©
cmd = "pandoc --verbose -t latex -o #{filename} #{tmpfile.path}"
works but does not produce any .tex file.
(d)
`pandoc --verbose -t latex -o #{filename} #{tmpfile.path}`
freezes (spinball).
Then I have added <$inputfile> 2>&1 >> splitter.log into the arguments field.
(e)
`multimarkdown -t latex -o #{filename} #{tmpfile.path}`
works without problem, produces files but log remains empty.
(f)
cmd = "pandoc --verbose -t latex -o #{filename} #{tmpfile.path} 2>&1"
works but does not produce any .tex file, log remains empty.
(g)
cmd = "pandoc --verbose -t latex -o #{filename} #{tmpfile.path}"
works but does not produce any .tex file, log remains empty.
(h)
`pandoc --verbose -t latex -o #{filename} #{tmpfile.path}`
works without problem, produces files (!) but log still remains empty
Now moving on to your Scrivener project:
(i) as provided it works fine (obviously). The log file reads:
[code]=== ------------------------------------------------------ ===
=== Splitter V1.0 Report @ 2019-04-22 11:10:54 +0200 ===
=== ------------------------------------------------------ ===
Working directory: /Users/me/Documents/Academic/Writing/troubleshooting/orig script/nontroppo_orig
Initiating with Ruby 2.3.7
Pandoc: /usr/local/bin/pandoc | V: 2.7.2
:: Running: pandoc --verbose -f markdown-auto_identifiers --biblatex --top-level-division=chapter --columns=120 -t latex -o 1-RedBook.tex /var/folders/11/yyzl685d0h11s7ctdldn02pc0000gn/T/1-RedBook.tex20190422-51634-1j9wcqj ::
:::: [WARNING] Note with key ‘cf100’ defined at line 1092 column 1 but not used.
… etc.
[/code]
(j) same setup but with nothing in the arguments field.
All works fine (but no .log file)
(k) put
<$inputfile> 2>&1 >> splitter.log
back into the argument field and changed the line
cmd = “pandoc …” to:
`pandoc --verbose -t latex -o #{filename} #{tmpfile.path}`
I get an error message "The file could not be created: There was a problem generating the file using my-script-2
"
and also a separate Error log:
[WARNING] Note with key 'cf100' defined at line 1084 column 1 but not used.
... a bunch of those warnings ...
[INFO] Not rendering RawBlock (Format "html") "<!-- All footnote and image references will appear here. -->"
/var/folders/11/yyzl685d0h11s7ctdldn02pc0000gn/T/my-script-2:46:in `block in <main>': undefined local variable or method `cmd' for main:Object (NameError)
from /var/folders/11/yyzl685d0h11s7ctdldn02pc0000gn/T/my-script-2:40:in `each_pair'
from /var/folders/11/yyzl685d0h11s7ctdldn02pc0000gn/T/my-script-2:40:in `<main>'
This produced the very first of the .tex files, but no other files. And here I do get the expected .log file with the content:
=== ------------------------------------------------------ ===
=== Splitter V1.0 Report @ 2019-04-22 11:06:20 +0200 ===
=== ------------------------------------------------------ ===
Working directory: /Users/me/Documents/Academic/Writing/troubleshooting/orig script/nontroppo_pp
Initiating with Ruby 2.3.7
Pandoc: /usr/local/bin/pandoc | V: 2.7.2
(l) same setup but with nothing in the arguments field.
Same result without .log file.
So, long story short. Your version of the script does work (which is what I’m now using).
However, I’m still curious as to what the original problem was. That script does work if error reports are redirected as in (h) above…