Hi Nathan

On Sun, Oct 12, 2014 at 5:35 PM, Nathan Gleaves <[email protected]>
wrote:

> Honestly, i not sure. I'm using web storm that has a lot of additional
> bells and whistles so they may actually have their own debugger.
>
> Also, the vm sandbox runner is not actually loading the file from the
> provided file name. I thin k its running some sort of check to see if its
> there. The code provided in the call is run.
>

The docs for runInNewContext are clear: the filename is provided for
inclusion in stack traces, and no attempt is made to load anything from it:

http://nodejs.org/api/vm.html#vm_vm_runinnewcontext_code_sandbox_filename

I'd say that the debugger is wrong to raise an error for not being able to
load the source file from the file system. I still think it's strange that
it attempts to open the file at all; the debugger already has access to the
source code that was passed to runInNewContext.


> Thanks for the responses. In an effort to clean up my debug code, i went
> ahead and made a slight change to the method in my fork, it will splice the
> file name from index 3, which cuts off the "$:/". this has some problems
> but the only main one i see is when a tiddler doesn't live where its title
> says it lives.
>

It may be worth trying not passing the filename at all. The stack traces
are less relevant if you're running in a debugger.

Best wishes

Jeremy


>
>
> On Saturday, October 11, 2014 3:05:26 PM UTC-5, Nathan Gleaves wrote:
>>
>> i have been working on understanding how the tiddlywiki core system works
>> and i have into a problem.  When i run in debug mode, i get lots of output
>> like:
>>
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\$:\core\modules\startup\commands.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\
>> core\\modules\\startup\\commands.js',
>>   syscall: 'open' }
>>
>>
>> this happens for every start up java script file the system tries to run
>> in the sandbox environment:
>>
>> $tw.utils.evalSandboxed = $tw.browser ? $tw.utils.evalGlobal : function(
>> code,context,filename) {
>>  var sandbox = $tw.utils.extend(Object.create(null),context);
>>     console.log(filename, context, code);
>>  vm.runInNewContext(code,sandbox,filename);
>>  return sandbox.exports;
>> };
>>
>> using the same configuration in run mode, i don't get any of this output.
>>
>> Obviously its because the vm system is choking on the $: syntax at the
>> beginning of tiddlers. I was tyring to find any snipet that was cleaning up
>> that file name.
>>
>> I have lots of these:
>>
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\$:\core\modules\filters\is\shadow.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\
>> core\\modules\\filters\\is\\shadow.js',
>>   syscall: 'open' }
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\$:\core\modules\filters\is\system.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\
>> core\\modules\\filters\\is\\system.js',
>>   syscall: 'open' }
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\$:\core\modules\filters\is\tag.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\
>> core\\modules\\filters\\is\\tag.js',
>>   syscall: 'open' }
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\$:\core\modules\filters\is\tiddler.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\$:\\
>> core\\modules\\filters\\is\\tiddler.js',
>>   syscall: 'open' }
>>
>>
>> The server does start up and server requests. Its seems that the v8 java
>> script engin is just complaining about the file name. I have put in a small
>> fix but that fix has revealed fomr other samall problems with the current
>> codebase.
>>
>>
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\core\modules\startup.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\
>> modules\\startup.js',
>>   syscall: 'open' }
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\core\modules\utils\parseutils.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\
>> modules\\utils\\parseutils.js',
>>   syscall: 'open' }
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\core\modules\utils\dom.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\
>> modules\\utils\\dom.js',
>>   syscall: 'open' }
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\core\modules\parsers\wikiparser\
>> rules\wikirulebase.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\core\\
>> modules\\parsers\\wikiparser\\rules\\wikirulebase.js',
>>   syscall: 'open' }
>> { [Error: ENOENT, no such file or directory 'c:\Users\Nathan\workspace\
>> webstorm\TiddlyWiki5\plugins\tiddlywiki\markdown\markdown.js']
>>   errno: 34,
>>   code: 'ENOENT',
>>   path: 'c:\\Users\\Nathan\\workspace\\webstorm\\TiddlyWiki5\\
>> plugins\\tiddlywiki\\markdown\\markdown.js',
>>   syscall: 'open' }
>>
>> All of these fail becaus the title filed on the javascript file defines a
>> different path than where the plugin actually exists.
>> core/modules/startup/startup.js
>> core/modules/parsers/parseutils.js
>> core/modules/utils/dom/dom.js
>> core/modules/parsers/wikiparser/wikirulebase.js
>>
>> the markdown plugin may have been triggered because im trying use it
>> tiddlywiki.files shows
>> {
>>  "tiddlers": [
>>  {
>>  "file": "markdown.js",
>>  "fields": {
>>  "type": "application/javascript",
>>  "title": "$:/plugins/tiddlywiki/markdown/markdown.js",
>>  "module-type": "library"
>>  }
>>  }
>>  ]
>> }
>>
>> which is probably why its throwing an error on running that script.
>> markdown wrapper:
>> title: $:/plugins/tiddlywiki/markdown/wrapper.js
>> the markdown.js doesn't define a title.
>>
>> Not a really big deal as it doesn't seem to effect the actual running of
>> the script.
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywikidev.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to